<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>数据统计</li>
    <li>入库统计</li>
    <li>入库详情</li>
  </ul>
</div>
<div class="rightinfo">
  <form id="stockDetailForm" th:action="@{/statis/stockView}" method="post">
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>仓库名称</th>
          <th>采购单编号</th>
          <th>商品数量</th>
          <th>金额</th>
          <th>入库时间</th>
          <th>入库人</th>
          <th>采购单详情</th>
        </tr>
      </thead>
      <tbody>
        <tr th:each=" stockDetail : ${stockDetailList.data}">
          <td th:text="${stockDetail.ck_id}">1</td>
          <td th:text="${stockDetail.ck_name}">南京21号仓库</td>
          <td th:text="${stockDetail.purchase_id}">CG201701270001</td>
          <td th:text="${stockDetail.goodsnum}">5</td>
          <td>￥[[${stockDetail.totalprice}]]</td>
          <td th:text="${#dates.format(stockDetail.rk_date,'yyyy-MM-dd HH:mm:ss')}">2017-01-25 15:05:05</td>
          <td th:text="${stockDetail.rk_user}">马云</td>
          <td>
          	<a href="../../storage/stock/stockView.html" class="tablelink">查看详情</a>
          </td>
        </tr>
      </tbody>
    </table>
    <div class="pagin">
      <input type="hidden" name="customid" th:value="${stockDetailList.data[0].ck_id}"/>
      <input type="hidden" name="pageNum" id="pageNum" th:value="${stockDetailList.pageNum}"/>
      <input type="hidden" name="totalPage" id="totalPage" th:value="${stockDetailList.totalPage}"/>
      <div class="message">共<i class="blue" th:text="${stockDetailList.totalRows}"></i>条记录，当前显示第&nbsp;<i class="blue" th:text="${stockDetailList.pageNum}" >2&nbsp;</i>页,总页数为<i class="blue" th:text="${stockDetailList.totalPage}"></i></div>
      <ul class="paginList">
        <li class="paginItem" id="shangyiye" onclick="shang()">上一页</li>
        <li class="paginItem"><input type="text" th:value="${stockDetailList.pageNum}" id="textFind" name="textFind" style="width: 40px;margin: 0 5px"/></li>
        <li class="paginItem" id="xiayiye" onclick="xia()">下一页</li>
      </ul>
    </div>
  </form>
</div>
<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
    $("#textFind").blur(function (){
      var totalPage = $("#totalPage").val();
      var pageNum = $("#textFind").val();
      if (totalPage < pageNum){
        alert("没有更多数据了");
        $("#pageNum").val(1);
        $("#stockDetailForm").submit();
      }else {
        $("#pageNum").val(pageNum);
        $("#stockDetailForm").submit();
      }
    })
    function shang(){
      var pageNum = $("#pageNum").val();
      if (pageNum > 1){
        pageNum--;
        $("#pageNum").val(pageNum);
        $("#stockDetailForm").submit();
      }else{
        alert("已经是第1页了！")
      }

    }
    function xia(){
      var pageNum = $("#pageNum").val();
      var totalPage = $("#totalPage").val();
      if (pageNum < totalPage){
        pageNum++;
        $("#pageNum").val(pageNum);
        $("#stockDetailForm").submit();
      }else {
        alert("已经是最后一页了！")
      }
    }
</script>
</body>
</html>
